<?php include "conexao.php";

$email = $_POST["email"];

$sql  = mysql_query("select email from newsletter where email='$email'");
$cont = mysql_num_rows($sql);
if($email==""){
echo "<font color=red>Digite seu email</font>";
exit();
}
if (!eregi("^[a-z0-9_\.\-]+@[a-z0-9_\.\-]*[a-z0-9_\-]+\.[a-z]{2,4}$", $email)) {
		echo "<font color=red>Email inv&aacute;lido, verifique a digita&ccedil;&atilde;o !!! </font>"; exit();
	}
if($cont!=""){
echo "<font color=blue>Este email j&aacute; est&aacute; cadastrado em nossa Newsletter</font>";
exit();
}
mysql_query("insert into newsletter (email)values('$email')");

echo "<font color=green>Email Cadastrado com Sucesso</font>";

?>